/**
 * @fileOverview <p>The eui.Table.Highlighter</p>
 * @author embrace.toolkit
 * @version $Id: TableHighlighter.js 106 2009-10-01 08:24:37Z embrace.toolkit $
 */
/**
 * @class Prototype UI Extension for default highlighting even/uneventable rows.
 * @public
 * 
 */
eui.Table.Highlighter = Class.create({
	/** @lends eui.Table.Highlighter */
	/**
	 * The referenced eui.Table.Table
	 * @private
	 * @type eui.Table.Table
	 */
	table: false,
	/**
	 * Called by constructor for setting up the eui.TableHighlighter.
	 * @param eui.Table.Highlighter.Options parameters options for use.
	 * @public
	 * @throws {NullPointerException} if table is null.
	 */
	initialize: function(parameters) {
		this.table = parameters.table;
		
		if(!this.table)
			throw("NullPointerException: Table could not be null.");
		
	},
	/**
	 * Runs the highlighting cross the table.
	 * @private
	 */
	run: function() {
		this.jsTable.table.select("tr[page]").invoke("removeClassName", "even");
		this.jsTable.table.select("tr[page]").invoke("removeClassName", "uneven");
		
		this.jsTable.table.select("tr[page]").each(function(tr, index) {
			var className = (index % 2) == 0 ? "even" : "uneven";
			tr.addClassName(className);
		});
	}		
});

/**
 * @class The used options for {@link eui.Table.Highlighter}.
 * @public
 * @author embrace.toolkit
 */
eui.Table.Highlighter.Options = Class.create({
	/** @lends eui.Table.Highlighter.Options */
	/**
	 * Reference to the calling {@link eui.Table}.
	 * @type eui.Table
	 * @public
	 */
	table: false
});